﻿using System;
using System.Linq.Expressions;
using System.Reflection;

namespace Rosieks.Web.Flow.Internals
{
    internal class ReflectionHelper
    {
        public static MethodInfo GetMethod<TClass, TResult>(Expression<Func<TClass, TResult>> method)
        {
            return ((MethodCallExpression)method.Body).Method;
        }

        public static MethodInfo GetGenericMethod<TClass, TResult>(Expression<Func<TClass, TResult>> method)
        {
            return ReflectionHelper.GetMethod(method).GetGenericMethodDefinition();
        }
    }
}
